package com.xibei.homepage.client;

import com.xibei.homepage.CourseInfo;
import com.xibei.homepage.CourseInfosRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * 1、声明式调用homepage-course中的方法，getCourseInfo和getCourseInfos；
 * 熔断降级,返回无效对象或空集合;
 */
@FeignClient(value="eureka-client-homepage-course",
        fallback = CourseClientHystrix.class)
public interface CourseClient {

    @RequestMapping(value="/homepage-course/get/course",
            method = RequestMethod.GET)
    CourseInfo getCourseInfo(Long id);

    @RequestMapping(value="/homepage-course/get/courses",method = RequestMethod.POST)
    List<CourseInfo> getCourseInfos(@RequestBody CourseInfosRequest request);

}
